import request from "@/utils/request";
export default {
  getSpulist(page, limit, category3Id) {
    return request({
      url: `/admin/product/${page}/${limit}`,
      method: "GET",
      params: { category3Id },
    });
  },
  getTardmakeList() {
    return request.get("/admin/product/baseTrademark/getTrademarkList");
  },
  getSaleAttrList() {
    return request.get("/admin/product/baseSaleAttrList");
  },
  get(spuId) {
    return request.get(`/admin/product/getSpuById/${spuId}`);
  },
  getSpuImageList(spuId) {
    return request.get(`/admin/product/spuImageList/${spuId}`);
  },
  addUpdate(spuInfo) {
    return request({
      url: `/admin/product/${spuInfo.id ? 'update' : 'save'}SpuInfo`,
      method: 'POST',
      data: spuInfo
    })
  },
  getList (category1Id, category2Id, category3Id) {
    return request.get(`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`)
  },
  getSpuSaleAttrList (spuId) {
    return request.get(`/admin/product/spuSaleAttrList/${spuId}`)
  },
  addUpdate (skuInfo) {
    return request.post(`/admin/product/${skuInfo.id ? 'update' : 'save'}SkuInfo`, skuInfo)
  },
  remove(spuId) {
    return request.delete(`/admin/product/deleteSpu/${spuId}`)
  },
};
